cmake_minimum_required(VERSION 3.20)
project(TeamProject C)

set(CMAKE_C_STANDARD 11)


# 多国语言支持与中文输入支持
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
    add_compile_options(-fexec-charset=GBK -finput-charset=UTF-8)
endif ()
add_compile_definitions(_UNICODE UNICODE)

if ("${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC")
    add_link_options("/SUBSYSTEM:CONSOLE")
    add_compile_options("$<$<C_COMPILER_ID:MSVC>:/source-charset:utf-8>")
    add_compile_options("$<$<C_COMPILER_ID:MSVC>:/execution-charset:gbk>")
endif ()

add_library(ConsoleLib "console/ConsoleSettings.c" "console/ConsoleSettings.h" inout/ddlinout.c inout/ddlinout.h note_by_WDC/search.c note_by_WDC/test.c note_by_WDC/search.h)
add_library(GuiLib "gui/WndUtil.h" "gui/WndUtil.c" "gui/AddWnd.c" "gui/AddWnd.h" gui/FontUtil.c gui/FontUtil.h gui/NoteWnd.c gui/NoteWnd.h)
add_library(ZMLib "zm/delete.c" "zm/modify.c" zm/del_and_mod.h)
add_library(PSLib "note_by_ps/addnew.h" "note_by_ps/printall.h" "note_by_ps/printall.c"
        "note_by_ps/addnew.c" "note_by_ps/test.c")
add_library(WDCLib note_by_WDC/search.h note_by_WDC/search.c)
add_library(HYLLib note/note.c
        note/note.h
        note/note_add.c
        note/note_out.c)

add_executable(TeamProject
        "console/ConsoleSettings.c" "console/ConsoleSettings.h"
        gui/WndUtil.c gui/WndUtil.h linked_list/struct_def.h    
        note/note.h)

# hylTest
add_executable(note note/text.c)
target_link_libraries(note HYLLib)

# jzyTest
add_executable(jzyTest note_by_jzy/menu.c note_by_jzy/menu.h main.c)
target_link_libraries(jzyTest ConsoleLib)
target_link_libraries(jzyTest GuiLib)
target_link_libraries(jzyTest ZMLib)
target_link_libraries(jzyTest WDCLib)
target_link_libraries(jzyTest PSLib)

#psTest
add_executable(psTest note_by_ps/addnew.c note_by_ps/test.c linked_list/struct_def.h inout/ddlinout.c inout/ddlinout.h note_by_ps/addnew.h note_by_ps/printall.h note_by_ps/printall.c console/ConsoleSettings.c console/ConsoleSettings.h)

# wdc_test
add_executable(wdcTest note_by_WDC/search.c note_by_WDC/test.c note_by_WDC/search.h note_by_ps/addnew.c note_by_ps/addnew.h inout/ddlinout.c inout/ddlinout.h console/ConsoleSettings.c console/ConsoleSettings.h)
